﻿<UserControl x:Class="BuyTicket.Views.LoginView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:vm="clr-namespace:BuyTicket.ViewModels"
             d:DesignHeight="300"
             d:DesignWidth="300"
             FontSize="16"
             Loaded="UserControl_Loaded"
             mc:Ignorable="d">
    <UserControl.DataContext>
        <vm:LoginViewModel Loaded="LoginViewModel_Loaded"
                           Loading="LoginViewModel_Loading"
                           Logined="LoginViewModel_Logined"
                           VerifyImageCompleted="LoginViewModel_VerifyImageCompleted" />
    </UserControl.DataContext>
    <DockPanel>
        <Border x:Name="myError"
                Background="Red"
                DockPanel.Dock="Top">
            <Label HorizontalAlignment="Center" Foreground="Blue">正在加载，请稍后...</Label>
        </Border>
        <Grid x:Name="myLogin"
              Width="220"
              Height="200">
            <Grid.RowDefinitions>
                <RowDefinition Height="30" />
                <RowDefinition Height="30" />
                <RowDefinition Height="50" />
                <RowDefinition Height="30" />
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="80" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>
            <TextBlock Grid.Row="0"
                       Grid.Column="0"
                       HorizontalAlignment="Center"
                       VerticalAlignment="Center">
                用户名：
            </TextBlock>
            <TextBox x:Name="txtName"
                     Grid.Row="0"
                     Grid.Column="1"
                     Height="25"
                     MinWidth="100"
                     HorizontalAlignment="Left"
                     VerticalAlignment="Center"
                     Text="{Binding UserName,UpdateSourceTrigger=PropertyChanged}" />
            <TextBlock Grid.Row="1"
                       Grid.Column="0"
                       HorizontalAlignment="Center"
                       VerticalAlignment="Center">
                密　码：
            </TextBlock>
            <TextBox x:Name="txtPass"
                     Grid.Row="1"
                     Grid.Column="1"
                     Height="25"
                     MinWidth="100"
                     HorizontalAlignment="Left"
                     VerticalAlignment="Center"
                     Text="{Binding PassWord,UpdateSourceTrigger=PropertyChanged}" />
            <Image x:Name="myVerifyImage"
                   Grid.Row="2"
                   Grid.Column="1" />
            <TextBlock Grid.Row="3"
                       Grid.Column="0"
                       HorizontalAlignment="Center"
                       VerticalAlignment="Center">
                验证码：
            </TextBlock>

            <StackPanel Grid.Row="3"
                        Grid.Column="1"
                        HorizontalAlignment="Left"
                        VerticalAlignment="Center"
                        Orientation="Horizontal">
                <TextBox Grid.Row="3"
                         Grid.Column="1"
                         Height="25"
                         MinWidth="60"
                         MaxLength="4"
                         Text="{Binding VerifyCode,UpdateSourceTrigger=PropertyChanged}" Name="txtVerifyCode" />
                <Rectangle MinWidth="5" />
                <Label>
                    <Hyperlink x:Name="myRefresh" Command="{Binding RefreshVerifyCodeCommand}">刷新</Hyperlink>
                </Label>
            </StackPanel>
            <Button Grid.Row="4"
                    Grid.Column="1"
                    Width="100"
                    Height="30"
                    IsDefault="True"
                    HorizontalAlignment="Left"
                    VerticalAlignment="Center"
                    Command="{Binding LoginCommand}"
                    Content="登 录" />

        </Grid>
    </DockPanel>
</UserControl>
